package com.gzkemays.music.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gzkemays.music.po.vo.MusicBasicInformationVo;
import lombok.*;

import java.io.Serializable;

/**
 * @author gzkemays
 * @since 2021-03-27
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Music implements Serializable {
  private static final long serialVersionUID = -390391433577322634L;
  /** 主键ID */
  @TableId(value = "id", type = IdType.AUTO)
  private Integer id;

  /** 地址 */
  private String url;

  /** 名称 */
  private String name;

  /** 歌手 */
  private String author;

  public static Music generatorMusic(MusicBasicInformationVo vo, String url) {
    Music music = new Music();
    music.setName(vo.getFileName());
    music.setAuthor(vo.getAuthor());
    music.setUrl(url);
    return music;
  }
}
